<template>
  <div class="hello">
    <h1>{{$t("m.findMusic")}}</h1>
    <h1>{{$t("m.myMusic")}}</h1>
    <h1>{{$t("m.friend")}}</h1>
    <h1>{{$t("m.musician")}}</h1>
    <h1>{{$t("m.download")}}</h1>
    <button @click='cha'>点击切换语言</button>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  methods:{
    cha(){
        console.log(this.lang)
        if(window.confirm('确认切换语言？')){
            if ( this.lang === 'zh-CN' ) {
                this.lang = 'en-US';
                this.$i18n.locale = this.lang;
            }else {
                this.lang = 'zh-CN';
                this.$i18n.locale = this.lang;
            }
        }
    }
  }

}
</script>
